package gmail.wenjiesha.victor;

import org.apache.commons.cli.BasicParser;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;

public class CLI {
	public static void main(String[] args) throws ParseException{
		Options opt = new Options();

        opt.addOption("port", true, "port");
        opt.addOption("addr", true, "address");
                
        String input = "-port 1234 -addr 127.0.0.1";
        String[] arg = input.split(" ");

        BasicParser parser = new BasicParser();
        CommandLine cl = parser.parse(opt, arg);
        
        System.out.println(cl.getOptionValue("addr"));
        
	}
}
